<!--
 * @Description  : 预览 下载pdf 
 * @Author       : zhao
 * @Date         : 2022-07-21 13:43:56
 * @LastEditors  : zhao
 * @LastEditTime : 2022-08-02 19:18:13
-->

<template>
    <div class="zpdf">
        ss
        {{ src }}
        <!-- <vue-pdf-embed :page="pageNum" :source="url" ref="myPdfComponent" /> -->
        <!-- <iframe width="100%" :src="src" frameborder="0" style="width: 100%; height: 100%"></iframe> -->
    </div>
</template>

<script setup>

// import * as pdf from 'vue-pdf-signature'
// import CMapReaderFactory from 'vue-pdf-signature/src/CMapReaderFactory.js'
import { ref, watch } from 'vue';

import { usePreview } from '/@/stores/preview'

const file = ref()
const usepreviews = usePreview()
let src = ref()
let numPages = ref()

// const goPreview = (data) => {
//     nextTick(() => {

//         src = pdf.createLoadingTask({ url: data, CMapReaderFactory })

//         src.promise.then((pdf) => {
//             numPages = pdf.numPages
//         })
//     })
// }
usepreviews.$subscribe((mutation, state) => {
    console.log("🚀 ~ file: pdf.vue ~ line 43 ~ usepreviews.$subscribe ~ state.previewType.url", state.previewType.url)
    src = state.previewType.url
    // goPreview(state.previewType.url)
})



</script>
<style lang='scss' scoped>
.zpdf {}
</style>